import Vue from 'vue';
import Router from 'vue-router';
import index from '../page/index';                             //首页
import bookMall from '../page/bookMall';                       //书城
import bookShelf from '../page/bookShelf';                     //我的书架
import userCenter from '../page/userCenter';                   //个人中心





Vue.use(Router);


export default new Router({
	mode: 'history',
	base: '/',
	routes: [
		{
			path: '/',
			component: index,
			name: 'index'
		},{
			path: '/index',
			component: index,
			name: 'index'
		},{
			path: '/bookMall',
			component: bookMall,
			name: 'bookMall'
		},{
			path: '/bookShelf',
			component: bookShelf,
			name: 'bookShelf'
		},{
			path: '/userCenter',
			component: userCenter,
			name: 'userCenter'
		},
	],
	scrollBehavior(to, from, savedPosition) {
		if (savedPosition) {
			return savedPosition;
		} else {
			document.scrollingElement.scrollTop = 0;
		}
	}
});